import time
import unittest
from public.HTMLTestRunner_cn import HTMLTestRunner

case_dir = './case'
discover = unittest.defaultTestLoader.discover(case_dir, pattern='test_*.py')

now = time.strftime("%Y-%m-%d %H_%M_%S")
report_path = './outputs/reports/自动化回归_' + now + '_result.html'

fp = open(report_path, "wb")
runner = HTMLTestRunner(title="api自动化测试报告",
                        description="自动化回归测试报告，详情见附件",
                        stream=fp,
                        verbosity=2,
                        retry=0,
                        save_last_try=True)
runner.run(discover)
